<template>
	<view class="page-content">
		<view class="body-box" @click="check">
			<view class="box-tit">{{i18n.userAccount.mimaguanli}}</view>
			<view class="icons-sel">{{formdata.psd_statu===false?i18n.userAccount.weishezhi:i18n.userAccount.yishezhi}}<text
					class="icon-tb icons icon-gengduo"></text></view>
		</view>
		<view class="body-box" @click="check">
			<view class="box-tit">{{i18n.userAccount.shoujibangding}}</view>
			<view class="icons-sel">{{formdata.pho_statu===false?i18n.userAccount.weishezhi:formdata.pho}}<text
					class="icon-tb icons icon-gengduo"></text></view>
		</view>
		<view class="but-box" @click="toLoginOut">
			{{i18n.userAccount.loginOut}}
		</view>
		<w-popup :show="showtip" :type="type1" @change="change1" :maskClick="false">
			<view class="w-tip">
				<view class="w-box">
					<view class="w-top">{{i18n.popup.tips}}</view>
					<view class="w-txt">{{i18n.popup.txt3}}</view>
				</view>
				<view class="w-but">
					<view class="w-cancel" @click="cancel">{{i18n.popup.cancel}}</view>
					<view class="w-comfirm" @click="comfirm">{{i18n.popup.confirm}}</view>
				</view>
			</view>
		</w-popup>
	</view>
</template>

<script>
	import wPopup from '@/components/w-popup/w-popup2.vue';
	import {
		mapGetters,
		mapActions
	} from "vuex";
	import store from '@/store';
	import {
		editUsers, 
	} from '@/common/api.js';
	export default {
		components: {
			wPopup
		},
		data() {
			return {
				formdata: {
					pho_statu: true,
					psd_statu: true,
					pho: '13405920257'
				},
				showtip: false, //是否显示弹窗1
				content1: '顶部弹 popup',
				type1: '', //弹窗显示方式
			}
		},
		computed: {
			i18n() {
				return this.$t('message');
			}
		},
		onShow() {
			// 导航栏多语言
			uni.setNavigationBarTitle({
				title: this.i18n.tabBar.userAccount
			});
		},
		onLoad(option) {

		},
		methods: {
			...mapActions(['loginOut']),
			toLoginOut(){
				this.content1 = 'center'
				this.type1 = 'center';
				this.showtip = true;
			},
			check(index) {

			},
			comfirm(){
				this.showtip = false;
				editUsers().then(res =>{
					console.log(222,res)
					if(res.code === 2000){
						uni.clearStorage();
						uni.navigateTo({
							url: '/pages/login/login',
						})
					}
				})
				
				
			},
			change1(e) {
				if (!e.show) {
					this.showtip = false;
				}
			},
			//取消
			cancel(type) {
				this.showtip = false;
			},
		}
	}
</script>

<style lang="scss">
	.weixuanzhong {
		width: 36rpx;
		height: 36rpx;
		background: #393939;
		border: 1px solid #646464;
		border-radius: 50%;
	}

	.page-content {
		width: 100vw;
		height: 100%;
		background: $uni-bg-color;
		color: $font-color-w;
		padding: $page-row-spacing;
	}

	.body-box {
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		background: $uni-bg-box-color;
		box-shadow: 0rpx 2rpx 9rpx 0rpx rgba(0, 0, 0, 0.44);
		border-radius: 20rpx;
		margin-bottom: 30rpx;
		padding: 30rpx 40rpx;
		color: #FFFFFF;

		.box-tit {
			display: flex;
			font-size: 32rpx;
			font-weight: 500;
			color: #FFFFFF;
		}

		.icons-sel {
			display: flex;
			align-items: center;
			font-size: 28rpx;
			font-weight: 400;
			color: #DDDDDD;

			.icon-tb {
				margin-left: 20rpx;
			}
		}
	}
	.but-box {
		position: fixed;
		bottom: 50rpx;
		left: 30rpx;
		right: 30rpx;
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
		background: $uni-but-bg-color;
		box-shadow: 0rpx 2rpx 9rpx 0rpx rgba(0, 0, 0, 0.44);
		border-radius: 20rpx;
		padding: 30rpx 40rpx;
		color: #FFFFFF;
		text-align: center;
		font-size: 32rpx;
		font-weight: 500;
	}
	/* 提示窗口 */
	.w-tip {
		display: flex;
		flex-direction: column;
		width: 90vw;
		min-height: 147rpx;
		border-radius: 10rpx;
		background-color: #fff;
		box-shadow: 0rpx 7rpx 7rpx 0rpx rgba(0, 0, 0, 0.1);
		margin: 30rpx auto 0;
		overflow: hidden;
	
		.w-box {
			display: flex;
			flex-direction: column;
			padding: 30rpx 54rpx;
			
	
			.w-top {
				font-size: 36rpx;
				font-weight: bold;
				text-align: center;
				line-height: 63rpx;
				color: #393939
			}
	
			.w-txt {
				font-size: 32rpx;
				font-weight: 400;
				line-height: 56rpx;
				color: #393939;
				text-align: center;
			}
		}
	
	
		.w-but {
			display: flex;
			text-align: center;
			height: 100rpx;
			.w-cancel{
				flex: 1;
				font-size: 32rpx;
				font-weight: 400;
				line-height: 100rpx;
				color: #393939;
				background: #E9E9E9;
			}
			.w-comfirm{
				flex: 1;
				font-size: 32rpx;
				font-weight: 400;
				line-height: 100rpx;
				color: #FFFFFF;
				background: #D40000;
			}
		}
	}
</style>
